package com.example.demo.config;

import com.example.demo.model.Result;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@ControllerAdvice
public class ErrorHandler {

    @ExceptionHandler
    public Result TotalReturnException(Exception e){
        return Result.fail(e);
    }
}
